<?php

/**
 * HeaderContent filter form base class.
 *
 * @package    iEasy
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseHeaderContentFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'content_id'        => new sfWidgetFormFilterInput(),
      'content_type_i'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contenttype'), 'add_empty' => true)),
      'create_time'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'modify_time'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'is_on_top_b'       => new sfWidgetFormFilterInput(),
      'order_i'           => new sfWidgetFormFilterInput(),
      'catalog_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'content_id'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'content_type_i'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Contenttype'), 'column' => 'content_type_id')),
      'create_time'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'modify_time'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'is_on_top_b'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'order_i'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'catalog_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Catalog'), 'column' => 'catalog_id')),
    ));

    $this->widgetSchema->setNameFormat('header_content_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'HeaderContent';
  }

  public function getFields()
  {
    return array(
      'header_content_id' => 'Number',
      'content_id'        => 'Number',
      'content_type_i'    => 'ForeignKey',
      'create_time'       => 'Date',
      'modify_time'       => 'Date',
      'is_on_top_b'       => 'Number',
      'order_i'           => 'Number',
      'catalog_id'        => 'ForeignKey',
    );
  }
}
